%this script creates three 'Pitas' clusters
%This example works poorly on K-means,
%FN - works poorly, NN - works well.

z_distance = 20;
C1 = create_cluster([0,0,-z_distance]',[10, 10, 1]', 45);
C2 = create_cluster([0,0,0]', [10, 10, 1]', 45);
C3 = create_cluster([0,0,z_distance]', [10, 10, 1]', 45);

my_ones = ones(1,45);
colors = [my_ones, my_ones*2, my_ones*3];
C = [C1, C2, C3];
scatter3(C(1,:), C(2,:), C(3,:), [], colors');
view(-20,15);
axis equal;
title('Generated Pita clusters')

%classification
figure;
class = kmeans(C', 3);
scatter3(C(1,:), C(2,:), C(3,:), [], class');
view(-20,15);
axis equal;
title('K-Means results')

%trying with dendogram with NN
figure;
class = clusterdata(C', 'maxclust', 3, 'linkage', 'single');
scatter3(C(1,:), C(2,:), C(3,:), [], class');
view(-20,15);
axis equal;
title('hierarchical results');